
<template>
<scroll-view scroll-y class="scrollPage">
	

	<view class="UCenter-bg ">
		
	   <view class="light line-blue text-bold" @click="goBack"> <text class="cuIcon-back"></text> 返回</view>
	  <image src="https://image.weilanwl.com/gif/wave.gif" mode="scaleToFill" class="gif-wave"></image>
	</view>
	  <view class="padding flex text-center text-grey bg-white ">
	  <view class="flex flex-sub flex-direction solid-right">
	    <view class="text-xxl text-blue"> <text class="cuIcon-vip text-blue"></text>我上传的讲评</view>
	  </view>
	  
	  <view class="action cu-btn round  line-green padding margin-sm" @click="upToweek">
	  		<text class="cuIcon-pullup text-lg"></text>
	  		<text class="text-lg text-bold">上传</text>
	  </view>
	</view>
	
	  	   
	  <view class="cu-card dynamic margin-top-sm margin-bottom-sm" v-for="(one,index) in weekList" :key="index">
		 
	  	<view class="cu-item shadow ">
	  		<view class="cu-list menu menu-avatar">
				
				
	  			<view class="flex ">
					
	  			
				<view class="cu-avatar lg round margin" :style="'background-image:url('+one.avatar+')'"></view>
				
				
	  				<view class="padding-sm">
	  					<view class="henflex">
	  						<view>{{one.report_people}}</view>
	  						<view class="right" >
	  							<view class="cu-tag round bg-blue sm">{{one.school}}</view>
	  						</view>
							<view class="right" >
	  						<view class="huati text-orange text-bold">#周末讲评#</view>
							</view>
	  					</view>
						<view class="right">
	  					<view class="text-gray text-sm flex justify-between">{{one.createtime|timeFormat}}</view>
						</view>
						
						<view class="henflex">
							<view></view>
							<view class="right" >
								<view class="cu-tag round bg-green sm">{{one.class}}</view>
							</view>
							<view class="right" >
							<view class="round cu-tag bg-yellow sm">{{one.place}}</view>
							</view>
							<view class="right" >
							<view class="round cu-tag sm" :class="one.teacher_here =='1'?'bg-red':'bg-grey'" >辅导员：{{one.teacher}}</view>
							</view>
							
						</view>
	  				</view>
					 <view class="cu-tag bg-red" :data-topicid ="one.id" @tap.stop="Deltopic">
						<text class='cuIcon-close'>删除</text>
					</view>
				
	  			</view>
	  		</view>
			<view class="padding">
				<textarea class="uni-textarea" auto-height disabled v-model="one.note"></textarea>
			</view>
	  		
	  		<view class="grid col-1 flex-sub padding-lr" >
	  			<image  mode="widthFix" class="response" :src="one.image"></image>
	  		</view>
	  		<view class="text-gray text-sm text-right padding">
	  			<text class="right">实到:{{one.true_number}}</text>
	  			<text class="right">应到:{{one.shoud_number}}</text>
	  		</view>
	  	</view>
	  </view>
	  
	  
	 
	    <!-- <view class="text-center" > -->
			
	   
	   
	    <view class="" v-if="weekList.length <= 0" >
	   <view class="padding-xl ErrorNetwork text-center" >
        <image src="../../../static/NotAvailable.png" mode="widthFix" style='width:60%' />
        <view class="text-bold text-gray" style="letter-spacing:6rpx;line-height:50rpx;font-size:26rpx">
            暂无讲评信息哟
        </view>
    </view>
	 
	   </view>
	   
	   
	   
	   
	   <view class="text-center" v-else-if="num < count">
	  	<view class="action cu-btn round line-blue padding margin-sm" @click="getMoreList">
	  			<text class="cuIcon-discover"></text>
	  			<text class="text-lg">加载更多</text>
	  	</view>
	  </view>
	  
	  
	    <view class="text-center" v-else="" >
	  	<view class="action  round line-blue padding margin-sm">
	  			<text class="cuIcon-flashlightopen"></text>
	  			<text class="text-sm">没有更多数据了哟</text>
	  	</view>
	  </view>
	  
	  
   
	</scroll-view>
</template>

<script>
	var _self;
export default {
    data() {
        return {
			weekList:[],
			count:'',
			num :10
			
        }
    },

    // 注册组件
    components: {},
	onLoad(){
		_self =this;
		this.getWeekListByUser();
	},
    methods: {
		goBack(){
			uni.navigateBack({
    delta: 1,
    animationType: 'pop-out',
    animationDuration: 200
});
		},
		upToweek(){
			 uni.navigateTo({
			 	url:'./send'
			 });
		},
		getMoreList(){
		     this.num+=10;
			 
			if(this.num >_self.count){
				this.num =_self.count;
			}
				this.$http.get('api/WeekendTopic/getWeekListByUser/num/'+num)
				.then(res => {
			_self.weekList = res.data.data;
			_self.count = res.data.msg;
				})
				.catch(err => {});
		},
		
		getWeekListByUser(){
	      this.$http.get('api/WeekendTopic/getWeekListByUser')
				.then(res => {
			_self.weekList = res.data.data;
			_self.count = res.data.msg;
			console.log(_self.weekList);
				})
				.catch(err => {});
			// uni.request({
			// 	url:'http://yiban.likecy.cn/api/WeekendTopic/getOneWeekList',
			// 	dataType:"JSON",
			// 	success(res) {
			// 		console.log(res.data);
			// 		_self.weekList = res.data.data;
			// 	}
			// });
			
		},
		Deltopic(e) {
			var delid =e.currentTarget.dataset.topicid;
			uni.showModal({
				title: '提示',
				content: '确定要删除这条讲评信息？',
				cancelText: '再看看',
				confirmText: '再见',
				success: res => {
					if (res.confirm) {
						// this.image='';
						_self.$http.post('api/WeekendTopic/delTopicByUser',{delid:delid})
						.then(res => {
							console.log(res);
								if(res.data.code ==1){
									uni.showToast({
										title:"删除成功"
									});
									this.getWeekListByUser();
								}else{
									uni.showToast({
										title:"删除失败"
									});
								}
						
							})
							.catch(err => {});
						
						
						
						
						
					}
				}
			})
		},
		
	},
	filters:{
		
		timeFormat:function(arg,type='YYYY-MM-DD h:m:s'){
			
			if(arg.toString().length==10){
				arg=arg*1000;
				//如果date为13位不需要乘1000
				//[js时间戳长度是13位]，php，java等时间戳长度为10位
			}
			var date = new Date(arg)
			var year = date.getFullYear();//获取年
			var mouth = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1);//月
			var day = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());//日
			var hour= (date.getHours() < 10 ? '0' + date.getHours() : date.getHours());//时
			var minute = (date.getMinutes() <10 ? '0' + date.getMinutes() : date.getMinutes());//分
			var second = (date.getSeconds() <10 ? '0' + date.getSeconds() : date.getSeconds());//秒
			if(type=='YYYY-MM-DD h:m:s'){
				return year+'-'+mouth+'-'+day+' '+hour+':'+minute+':'+second;
			}
			
		}
	
	},
};
</script>





<style>
	
	.cu-tag.sm {
		  font-size: 20rpx;
		  padding: 0rpx 12rpx;
		  height: 32rpx;
		}
	.right {
		margin-left: 20upx;
	}
	
	.henflex {
		display: flex;
		flex-flow: row;
		padding: 10upx;
	}
	.UCenter-bg {
	  background-image: url("../../../static/home.jpeg");
	  background-size: cover;
	  height: 550rpx;
	  display: flex;
	  /* justify-content: center; */
	  padding-top: 40rpx;
	  overflow: hidden;
	  position: relative;
	  flex-direction: column;
	  align-items: start;
	  color: #39B54A;
	  font-weight: 300;
	  /* text-shadow: 0 0 3px rgba(0, 0, 0, 0.3); */
	}
	.UCenter-bg .gif-wave{
	  position: absolute;
	  width: 100%;
	  bottom: 0;
	  left: 0;
	  z-index: 99;
	  mix-blend-mode: screen;  
	  height: 100rpx;   
	}
	

</style>